﻿@model BlogAppExt.Models.PostDetailVM

<div class="jumbotron">
    <div class="row">

        <div class="col-sm-2">
            <img class="img-responsive img-circle" src="@Model.User.Image" />

        </div>

        <div>

            <h2>@Model.Post.Title</h2>
            <h3>@Model.User.NameFirst @Model.User.NameLast</h3>
        </div>
    </div>

</div>

<div class="container">

    <div class="row well">

        <div class="col-sm-9">
            <p>@Model.Post.Text</p>

        </div>
        <div class="col-sm-1"></div>
        <div class="col-sm-2">

            <a class="btn btn-info btn-sm btn-block" href="/Home/EditPost/@Model.Post.Id">Edit Post</a>
        </div>

    </div>

    <div class="row well">
        <div class="col-sm-9">
            <h4>Comments...</h4>

        </div>
        <div class="col-sm-1"></div>
        <div class="col-sm-2">

            <a class="btn btn-info btn-sm btn-block" href="/Home/NewComment/@Model.Post.Id">+ Add Comment</a>
        </div>

    </div>

    <div class="row">
        <table class="table">
            @foreach (var comment in Model.Comments)
            {
                <tr>
                    <td class="col-sm-2">@comment.UserName</td>
                    <td class="col-sm-9">@comment.Text</td>
                    <td class="col-sm-1">
                        <form method="post" action="/Home/DeleteComment">
                            <input hidden type="text" name="commentId" value="@comment.PostId" />
                            <input hidden type="text" name="postId" value="@Model.Post.Id" />
                            <input class="btn btn-danger btn-sm" type="submit" value="X" />
                        </form>
                    </td>
                </tr>
            }


        </table>

    </div>
</div>